package com.yuw.oop.statics;

public class Person {
    // 属性
    private String perName;
    private String perSex;
    private int perAge;
    // 父类
    String schoolName = "tjise";


    // 静态语句块
    static{
        System.out.println("执行了Person类中的静态语句块的代码");
        //schoolName = "";
    }

    // 非静态语句块
    {
        System.out.println("执行了Person类中的非静态语句块的代码");
        //schoolName = "";
    }

    // getter/setter接口

    public String getPerName() {
        return perName;
    }

    public void setPerName(String perName) {
        this.perName = perName;
    }

    public String getPerSex() {
        return perSex;
    }

    public void setPerSex(String perSex) {
        this.perSex = perSex;
    }

    public int getPerAge() {
        return perAge;
    }

    public void setPerAge(int perAge) {
        this.perAge = perAge;
    }

    //提供构造方法
    // 默认的构造方法
    public Person() {
        System.out.println("执行了父类Person的默认的构造方法");
    }

    // 构造方法
    public Person(String perName, String perSex, int perAge) {
        this.perName = perName;
        this.perSex = perSex;
        this.perAge = perAge;
        System.out.println("执行了父类Person的自定义的构造方法");
    }

    // 行为

    /**
     * 吃饭的行为
     */
    public void doEating() {
        // 行为
        System.out.println("I am eating...");
    }

    /**
     * 睡觉的行为
     */
    public void doSleeping() {
        System.out.println("I am sleeping...");
    }

    /**
     * 静态方法
     */
    public static void doBreathing() {
        System.out.println("I am breathing... @ Person");
    }
}
